<!DOCTYPE html>
<html lang="zh-cmn-Hans" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telphone=no, email=no">
    <script type="text/javascript" src="/h5/newall/newall.js"></script>
    <link rel="stylesheet" type="text/css" href="/h5/newall/newall.css">
    <title>测试系统</title>

    <meta name="csrf-param" content="_csrf">
    <meta name="csrf-token"
          content="pQ-0FRkDbJxb2j36-f76nHKnuG4a_YvFg9Cpj3jqcN_pOfJlLmwrzxyUcZDLh56oAsjwA1aNzILxocfKIJhA8g==">


</head>
<script type="text/javascript" src="/h5/js/all2.js"></script>
<div class="H5body">
    <mcform id="Form" class="mctag msglistDiv">
        <div class="content">
            <mctitle class="mctag">极光聊天测试</mctitle>
            <p mcname="username">当前登录状态:{{username}}</p>
            <p class="desc">最近联系人</p>
            <ul mcname="msglist" class="ul">
                <li v-for="obj of msglist" class="mui-input-row clearfix" :callid="obj.username">
                    <div class="headpicDiv">
                        <img :src="obj.pic" class="headpic"/>
                        <span class="name">{{obj.name}}</span>
                        <span v-bind:class="{'countshow':obj.unread_msg_count>0}" class="unread_msg_count">{{obj.unread_msg_count}}</span>
                    </div>
                    <div class="timediv">
                        <span class="time">{{obj.time}}</span>
                    </div>
                </li>
            </ul>
        </div>
    </mcform>

</div>
<style>
    .msglistDiv .headpicDiv {
        width: 1rem;
        float: left;

    }

    .msglistDiv .headpicDiv .name{
        display: block;
        width: 100%;
        text-align: center;
    }

    .msglistDiv .timediv {
        width: 1rem;
        float: right;
    }
    .msglistDiv .headpicDiv .countshow{
        display: block;
    }
    .headpicDiv .unread_msg_count{
        display: none;
        position: absolute;
        top: 0.1rem;
        left: 0.1rem;
        background-color: #ef5252;
        border-radius: 0.5rem;
        color: white;
        width: 0.2rem;
        height: 0.2rem;
        text-align: center;
        line-height: 0.2rem;
    }

    .msglistDiv .headpicDiv .headpic {
        width: 0.8rem;
        height: 0.8rem;
        display: block;
        border-radius: 1rem;
        text-align: center;
        margin: 0 auto;
    }
</style>
<script>
    MC.msg.showLoad();
    MC.user.getInfo(function(){},function(){
        MC.msg.hideLoad();
    });
    function getConversation(data){
        console.log("获取获取会话列表",data);
        var jiguangid=[];
        var list=[];
        for (var i=0;i<data.conversations.length;i++){
            var one=data.conversations[i];

            jiguangid.push(one.username);
        }
        let jiguangidstr=jiguangid.join(',');
       /* MC.apiD("getUserAvatar",{
            jiguang_id:jiguangidstr
        },function (objlist) {*/
         //   console.log(objlist);
            for (var i=data.conversations.length-1;i>=0;i--){
                var one=data.conversations[i];
                  list.push({
                      name: one.nickName,
                      pic: MC.HOST+"/api/app/avatar?jid="+one.name,
                      time: MC.API.timeTostr(one.mtime),
                      username:one.username,
                      unread_msg_count:one.unread_msg_count
                  });
            }
      //  });
       // console.log(jiguangidstr);
        view.vue.msglist=list;
        MC.msg.hideLoad();
    }

    var view = new MC.View.MCform('#Form');
    MC.Call.onSuccess(function () {
        MC.Call.getConversation(function (data) {
            getConversation(data);
        });
    });



</script>


</html>
